home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / listings / v_12_12 / allison / dynarray.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1994-10-04  |  456 b   |  26 lines

  1. LISTING 7 - Illustrates a dynamic array
  2.  
  3. #include <iostream.h>
  4. #include <dynarray.h>
  5.  
  6. main()
  7. {
  8.     const size_t NSTRINGS = 5;
  9.     char *strings[NSTRINGS] =
  10.       {"Go","west","young","C++","hacker"};
  11.     dynarray<char *> strvec;
  12.  
  13.     for (int i = 0; i < NSTRINGS; ++i)
  14.         strvec.append(strings[i]);
  15.     for (i = 0; i < strvec.length(); ++i)
  16.         cout << strvec[i] << endl;
  17.     return 0;
  18. }
  19.  
  20. /* Output:
  21. Go
  22. west
  23. young
  24. C++
  25. */
  26.